<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            position: absolute;
            width: 200px;
            height: 200px;
            background-color: pink;
            /*不能通过 margin: 0 auto;水平居中 */
            /* 先left浏览器的50%，再往左自身的50% */
            left: 50%;
            margin-left: -100px;
            top: 50%;
            margin-top: -100px;

        }
    </style>
</head>

<body>
    <div class="box"></div>

</body>

</html>